package com.woniu.adopt_web.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;

import com.woniu.adopt_web.entity.PetArticle;
import com.woniu.adopt_web.mapper.PetArticleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PetArticleService {
    @Autowired
    PetArticleMapper petArticleMapper;

    public PageInfo<PetArticle> queryByPage(int pageNum, int pageSize, String title) {
        PageHelper.startPage(pageNum, pageSize);
        List<PetArticle> petArticles = petArticleMapper.selectByConf(title);
        return new PageInfo<>(petArticles);
    }

    public int updateViews(int id) {
        return petArticleMapper.updateViews(id);
    }

    public PetArticle queryById(int id) {
        return petArticleMapper.selectByPrimaryKey(id);
    }





}
